package com.rectcircle.wechat.msg.vo;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class MassMessage {
	private Map<String, Object> filter = null;

	private List<String> touser = null;
	private String toUser = null;
	private String towxname=null;

	private Map<String, String> customservice = null;

	private Map<String, String> text = null;

	private Map<String, String> image = null;
	private Map<String, String> voice = null;

	private Map<String, String> video = null;

	private Map<String, String> mpvideo = null;

	private Map<String, String> music = null;
	private Map<String, List<NewsItem>> news = null;

	private Map<String, String> mpnews = null;
	private Map<String, String> wxcard = null;
	private String msgtype = null;
	public MassMessage() {

	}
	public MassMessage(String msgtype) {
		this.msgtype = msgtype;
	}

	public void addToUser(String openid){
		if(touser==null){
			touser = new LinkedList<>();
		}
		touser.add(openid);
	}

	public Map<String, String> getCustomservice() {
		return customservice;
	}
	public Map<String, Object> getFilter() {
		return filter;
	}
	public Map<String, String> getImage() {
		return image;
	}
	
	public Map<String, String> getMpnews() {
		return mpnews;
	}
	
	public Map<String, String> getMpvideo() {
		return mpvideo;
	}

	public String getMsgtype() {
		return msgtype;
	}

	public Map<String, String> getMusic() {
		return music;
	}
	
	
	public Map<String, List<NewsItem>> getNews() {
		return news;
	}

	public Map<String, String> getText() {
		return text;
	}
	
	public List<String> getTouser() {
		return touser;
	}
	
	public String getToUser() {
		return toUser;
	}

	public String getTowxname() {
		return towxname;
	}
	
	public Map<String, String> getVideo() {
		return video;
	}

	public Map<String, String> getVoice() {
		return voice;
	}

	public Map<String, String> getWxcard() {
		return wxcard;
	}

	public void setArticles(List<NewsItem> articles) {
		news = new HashMap<>();
		news.put("articles", articles);
	}


	public void setCustomservice(Map<String, String> customservice) {
		this.customservice = customservice;
	}

	public void setFilter(Map<String, Object> filter) {
		this.filter = filter;
	}

	public void setFilterParam(boolean is_to_all, int group_id){
		filter = new HashMap<>();
		filter.put("is_to_all", is_to_all);
		filter.put("group_id", group_id);
		
	}

	public void setImage(Map<String, String> image) {
		this.image = image;
	}

	public void setImageId(String imageId) {
		image = new HashMap<>();
		image.put("media_id", imageId);
	}

	public void setKf_account(String kf_account) {
		if(kf_account!=null){
			customservice = new HashMap<>();
			customservice.put("kf_account", kf_account);
		}
		
	}

	public void setMpnews(Map<String, String> mpnews) {
		this.mpnews = mpnews;
	}

	public void setMpNewsMedia_id(String media_id) {
		mpnews = new HashMap<>();
		mpnews.put("media_id", media_id);
	}

	public void setMpvideo(Map<String, String> mpvideo) {
		this.mpvideo = mpvideo;
	}

	public void setMpVideoId(String media_id){
		mpvideo = new HashMap<>();
		mpvideo.put("media_id", media_id);
	}

	public void setMsgtype(String msgtype) {
		this.msgtype = msgtype;
	}

	public void setMusic(Map<String, String> music) {
		this.music = music;
	}

	public void setMusicInfo(String musicurl, String hqmusicurl, String thumb_media_id, String title,
			String description) {
		music = new HashMap<>();
		music.put("musicurl", musicurl);
		music.put("hqmusicurl", hqmusicurl);
		music.put("thumb_media_id", thumb_media_id);
		music.put("title", title);
		music.put("description", description);
	}

	public void setNews(Map<String, List<NewsItem>> news) {
		this.news = news;
	}

	public void setText(Map<String, String> text) {
		this.text = text;
	}

	public void setTextContent(String content){
		text = new HashMap<>();
		text.put("content", content);
	}

	public void setTouser(List<String> touser) {
		this.touser = touser;
	}
	
	public void setToUser(String toUser) {
		this.toUser = toUser;
	}
	
	public void setTowxname(String towxname) {
		this.towxname = towxname;
	}

	public void setVideo(Map<String, String> video) {
		this.video = video;
	}

	public void setVideoInfo(String media_id, String thumb_media_id, String title, String description) {
		video = new HashMap<>();
		video.put("media_id", media_id);
		video.put("thumb_media_id", thumb_media_id);
		video.put("title", title);
		video.put("description", description);
		
	}

	public void setVoice(Map<String, String> voice) {
		this.voice = voice;
	}

	public void setVoiceId(String voiceId) {
		voice = new HashMap<>();
		voice.put("media_id", voiceId);		
	}

	public void setWxcard(Map<String, String> wxcard) {
		this.wxcard = wxcard;
	}

	public void setWxcardId(String card_id) {
		wxcard = new HashMap<String, String>();
		wxcard.put("card_id",card_id);
		
	}

	
	public void setWxcardInfo(String card_id, String card_ext) {
		wxcard = new HashMap<String, String>();
		wxcard.put("card_id",card_id);
		wxcard.put("card_ext", card_ext);
		
	}

	@Override
	public String toString() {
		return "MassMessage [filter=" + filter + ", msgtype=" + msgtype + ", touser=" + touser + ", customservice="
				+ customservice + ", text=" + text + ", image=" + image + ", voice=" + voice + ", video=" + video
				+ ", music=" + music + ", news=" + news + ", mpnews=" + mpnews + ", wxcard=" + wxcard + "]";
	}
	
}
